import os

OUT_ROOT = "_Out"
ECLIPSE = "D:/Programs/_Programming/Eclipse"

CLASSES = "Classes"
CLASSES = os.path.join(OUT_ROOT, CLASSES)

JARS = "Jars"
JARS = os.path.join(OUT_ROOT, JARS)

JEB_JAR = "jeconbond.jar"

###

JUNIT = "plugins/org.junit4_4.3.1/junit.jar"

SOURCE_PATH="""/
Tests
Outer/LaboratoryQ
Src/Base/Bond
Src/Base/Fleming
Src/Experiments/0-Mr-Connery/Connery
Src/Experiments/0-Mr-Connery/Thunderball
Src/Experiments/0-Mr-Connery/Goldfinger
Src/Experiments/1-Mr-Moore/Moore
Src/Experiments/1-Mr-Moore/Moonraker
Src/Experiments/1-Mr-Moore/Octopussy
Src/Experiments/1-Mr-Moore/AView2AKill
Src/Experiments/2-Mr-Brosnen/Brosnen
Src/Experiments/2-Mr-Brosnen/GoldenEye
Src/Experiments/2-Mr-Brosnen/TomorrowNeverDies
Src/Experiments/2-Mr-Brosnen/TheWorldIsNotEnough
Src/Experiments/3-Mr-Craig/CasinoRoyale
Src/Experiments/3-Mr-Craig/Craig
"""
SOURCE_PATH = SOURCE_PATH.replace("\n", ";")

###

import os

def mkd(d):
	if not os.path.exists(d):
		os.makedirs(d)

os.chdir("..")

mkd(CLASSES)
mkd(JARS)

junitGlob = os.path.join(ECLIPSE, JUNIT)
cmpl = "javac CM/comp_coll.java -sourcepath " + SOURCE_PATH + " -cp " + junitGlob + " -d " + CLASSES
os.system(cmpl)

os.system("del " + os.path.join(CLASSES, "comp_coll.class"))
os.system("rm " + os.path.join(CLASSES, "comp_coll.class"))

os.chdir(CLASSES)
jarcmd = "jar cvf " + os.path.join("..", "..", JARS, JEB_JAR) + " * -M"
os.system(jarcmd)
os.chdir("../..")

xcpcmd = "xcopy " + junitGlob + " " + JARS + "/"
os.system(xcpcmd.replace("/", "\\"))
os.system("cp " + junitGlob + " " + JARS + "/")


